<?php 
namespace app\seller\controller;
use app\common\controller\Seller;
use app\common\model\Room;
use app\common\model\Live as LiveModel;
class Live extends Seller
{
	/**
	 * 直播间
	 * @return [type] [description]
	 */
	public function room()
	{
		if(request()->isPost()){
			$data=input('post.');
            $this->searchvar($data);
            $list=(new Room)->withSearch(
                ['ctime','name'],
                ['ctime'=>[$this->start,$this->end],'name'=>$this->search])
            ->withJoin(['user'=>['nickname'],'goodcat'=>['name'],'area'=>['name']],'left')
            ->order('views desc')
            ->paginate(['list_rows'=>$this->limit,'page'=>$this->page])->toArray();
            return json(['code'=>0,'data'=>$list['data'],'count'=>$list['total']]);
		}else{
			return view();
		}
	}
	/**
	 * 直播视频
	 * @return [type] [description]
	 */
	public function live()
	{
		if(request()->isPost()){
			$data=input('post.');
            $this->searchvar($data);
            $list=(new LiveModel)->withSearch(
                ['ctime','name'],
                ['ctime'=>[$this->start,$this->end],'name'=>$this->search])
            ->withJoin(['user'=>['nickname'],'goodcat'=>['name'],'area'=>['name']],'left')
            ->order('views desc')
            ->paginate(['list_rows'=>$this->limit,'page'=>$this->page])->toArray();
            return json(['code'=>0,'data'=>$list['data'],'count'=>$list['total']]);
		}else{
			return view();
		}
	}
}